package com.zhouxiaoge.adapterpattern.interfacesImpl;

import com.zhouxiaoge.adapterpattern.adapter.MediaAdapter;
import com.zhouxiaoge.adapterpattern.interfaces.MediaPlayer;

public class AudioPlayer implements MediaPlayer {

    private MediaAdapter mediaAdapter;

    @Override
    public void play(String audioType, String fileName) {
        if (audioType.equalsIgnoreCase("mp3")) {
            System.out.println("Playing mp3 file.Name : " + fileName);
        } else if (audioType.equalsIgnoreCase("vlc") || audioType.equalsIgnoreCase("mp4")) {
            mediaAdapter = new MediaAdapter(audioType);
            mediaAdapter.play(audioType, fileName);
        } else {
            System.out.println("Invalid media. " + audioType + "format not supported");
        }
    }
}
